
export const FIELDS_PATH = {
  width: 'size/width',
  height: 'size/height',
  startX: 'position/x',
  startY: 'position/y',
  rotate: 'angle'
}
export interface NodeDataConfig {
  startX: number;
  startY: number;
  width: number;
  height: number;
  contentType: string;
  contentTitle: string | null;
  contentBackgroundColor: string;
  backgroundTransparent: number;
  border: number;
  rotate: number;
  visible: number;
  borderColor?: string;
  borderSize?: number;
  cornerWidth?: number;
  cornerHeight?: number;
  diagonalType?: string;
  lineThickness?: number;
  contentColor?: string;
  contentValue?: string | null | undefined;
  autoScale?: number;
  imageDithering?: string;
  contentAlignment?: string;
  contentVerticalAlignment?: string;
  fontSize?: number;
  fontType?: string | null;
  fontBold?: boolean;
  fontItalic?: boolean;
  textDecoration?: string;
  _isPreserveAspectRatio?: boolean;
  barHeight?: number;
  strikeThrough?: number;
  humanReadable?: string;
  humanReadableFontType?: string;
}


export interface NodeConfig  {
  shape: NodeShapeType;
  data: NodeDataConfig
}
export type NodeShapeType = 'CONTENT_TYPE_ABORDER' | 'CONTENT_TYPE_LINE' | 'CONTENT_TYPE_IMAGE' | 'CONTENT_TYPE_TEXT' | 'CONTENT_TYPE_QRCODE' | 'CONTENT_TYPE_BARCODE' | 'CONTENT_TYPE_NUMBER'
export type NodeListConfig = {
  [key in NodeShapeType]: {
    key: NodeShapeType;
    title: string;
    icon: string;
    config: NodeConfig;
  };
};
export const NODE_CONFIG: NodeListConfig = {
  CONTENT_TYPE_ABORDER: {
    key: 'CONTENT_TYPE_ABORDER',
    title: '矩形',
    icon: 'RectangleOne',
    config: {
      shape: 'CONTENT_TYPE_ABORDER',
      data: {
        startX: 0,
        width: 50,
        startY: 0,
        height: 50,
        cornerWidth: 0,
        cornerHeight: 0,
        contentType: 'CONTENT_TYPE_ABORDER',
        contentTitle: null,
        contentBackgroundColor: 'black',
        backgroundTransparent: 2,
        border: 1,
        borderColor: 'black',
        borderSize: 1,
        rotate: 0,
        visible: 1
      }
    }
  },
  CONTENT_TYPE_LINE: {
    key: 'CONTENT_TYPE_LINE',
    title: '直线',
    icon: 'Connection',
    config: {
      shape: 'CONTENT_TYPE_LINE',
      data: {
        startX: 0,
        width: 50,
        startY: 0,
        height: 50,
        contentType: 'CONTENT_TYPE_LINE',
        contentTitle: null,
        diagonalType: 'MAJOR',
        lineThickness: 1,
        contentColor: 'black',
        contentBackgroundColor: 'white',
        backgroundTransparent: 2,
        border: 1,
        rotate: 0,
        visible: 1
      }
    }
  },
  CONTENT_TYPE_IMAGE: {
    key: 'CONTENT_TYPE_IMAGE',
    title: '图片',
    icon: 'Pic',
    config: {
      shape: 'CONTENT_TYPE_IMAGE',
      data: {
        startX: 0,
        width: 50,
        startY: 0,
        height: 50,
        contentType: 'CONTENT_TYPE_IMAGE',
        contentTitle: null,
        contentValue: null,
        // customContentValue: null,
        contentBackgroundColor: 'white',
        backgroundTransparent: 2,
        border: 1,
        cornerWidth: 0,
        cornerHeight: 0,
        rotate: 0,
        visible: 1,
        autoScale: 1,
        imageDithering: 'NONE'
      }
    }
  },
  CONTENT_TYPE_TEXT: {
    key: 'CONTENT_TYPE_TEXT',
    title: '文本',
    icon: 'Text',
    config: {
      shape: 'CONTENT_TYPE_TEXT',
      data: {
        startX: 0,
        width: 120,
        startY: 0,
        height: 40,
        contentTitle: null,
        contentValue: '默认文本',
        contentType: 'CONTENT_TYPE_TEXT',
        // customContentValue: null,
        contentColor: 'black',
        contentBackgroundColor: 'white',
        contentAlignment: 'left',
        contentVerticalAlignment: 'top',
        backgroundTransparent: 2,
        border: 2,
        cornerWidth: 0,
        cornerHeight: 0,
        rotate: 0,
        visible: 1,
        fontSize: 18,
        fontType: null,
        fontBold: false,
        fontItalic: null,
        textDecoration: 'none'
      }
    }
  },
  CONTENT_TYPE_QRCODE: {
    key: 'CONTENT_TYPE_QRCODE',
    title: '二维码',
    icon: 'TwoDimensionalCodeOne',
    config: {
      shape: 'CONTENT_TYPE_QRCODE',
      data: {
        startX: 0,
        width: 50,
        startY: 0,
        height: 50,
        contentType: 'CONTENT_TYPE_QRCODE',
        contentTitle: null,
        contentValue: '默认文本',
        // customContentValue: '',
        contentColor: 'white',
        contentBackgroundColor: 'black',
        backgroundTransparent: 2,
        _isPreserveAspectRatio: true,
        border: 2,
        cornerWidth: 0,
        cornerHeight: 0,
        rotate: 0,
        visible: 1
      }
    }
  },
  CONTENT_TYPE_BARCODE: {
    key: 'CONTENT_TYPE_BARCODE',
    title: '条形码',
    icon: 'BarCode',
    config: {
      shape: 'CONTENT_TYPE_BARCODE',
      data: {
        startX: 0,
        width: 120,
        startY: 0,
        height: 40,
        contentType: 'CONTENT_TYPE_BARCODE',
        contentTitle: null,
        contentValue: 'barcode',
        // customContentValue: null,
        contentColor: 'black',
        contentBackgroundColor: 'white',
        backgroundTransparent: 2,
        border: 2,
        cornerWidth: 0,
        cornerHeight: 0,
        rotate: 0,
        visible: 1,
        barHeight: 50,
        strikeThrough: 2,
        humanReadable: 'none',
        humanReadableFontType: 'CODE128',
        autoScale: 2
      }
    }
  },
  CONTENT_TYPE_NUMBER: {
    key: 'CONTENT_TYPE_NUMBER',
    title: '数字',
    icon: 'ListNumbers',
    config: {
      shape: 'CONTENT_TYPE_NUMBER',
      data: {
        startX: 0,
        width: 120,
        startY: 0,
        height: 40,
        contentType: 'CONTENT_TYPE_NUMBER',
        contentTitle: null,
        contentValue: '0.00',
        // customContentValue: '',
        contentColor: 'black',
        contentBackgroundColor: 'white',
        contentAlignment: 'left',
        contentVerticalAlignment: 'top',
        backgroundTransparent: 2,
        border: 2,
        cornerWidth: 0,
        cornerHeight: 0,
        rotate: 0,
        visible: 1,
        fontSize: 18,
        fontType: null,
        fontBold: null,
        fontItalic: null,
        textDecoration: 'none'
      }
    }
  }
}
/**
 * 条形码格式配置
 * @type {string[]}
 */
export const ENCODE_LIST:string[] = [
  'CODE128',
  'CODE39'
]
